package com.token.iot.bratterycharging.gateway;

import com.outstanding.framework.core.BaseEnum;

public enum CodeType implements BaseEnum<CodeType, Integer> {
	
	Send(10,"下行"),
	Oper(11,"上行"),
	;
	
	private Integer code;
	private String msg;
	
	public String getMsg() {
		return msg;
	}
	
	public void setMsg(String msg) {
		this.msg = msg;
	}
	
	private  CodeType (Integer code, String msg) {
		this.code = code;
		this.msg = msg;
		
	}
	
	public Integer getCode() {
		return code;
	}
	
	public void setCode(Integer code) {
		this.code = code;
	}
	
	@Override
	public String getMessage() {
		return this.msg;
	}
	
	/**
	 * 通过枚举<code>code</code>获得枚举
	 * 
	 * @param code code
	 * @return  CodeType
	 */
	public static CodeType getByCode(String code) {
		for ( CodeType acType : values()) {
			if (acType.getCode().equals(code)) {
				return acType;
			}
		}
		return null;
	}
	
}
